package cn.maxhou.util;/**
 * @ClassName : R
 * @Description : 
 * @Author : LZ
 * @Date: 2025/4/1 10:00:02
 */
 public class R {
    private Integer code;
    private String msg;
    private Object data;


 public R() {
 }

 public R(Integer code, String msg, Object data) {
  this.code = code;
  this.msg = msg;
  this.data = data;
 }

 public R ok(){
  this.code = 200;
  this.msg = null;
  this.data = null;
  return  new R(code,msg,data);
 }
 public R ok (String msg,Object data){
  this.code = 200;
  this.msg = msg;
  this.data = data;
  return  new R(code,msg,data);
 }

 public R fail(){
  this.code = 500;
  this.msg = null;
  this.data = null;
  return  new R(code,msg,data);
 }

 public R fail(String msg){
  this.code = 500;
  this.msg = msg;
  this.data = null;
  return  new R(code,msg,data);
 }
 /**
  * 获取
  * @return code
  */
 public Integer getCode() {
  return code;
 }

 /**
  * 设置
  * @param code
  */
 public void setCode(Integer code) {
  this.code = code;
 }

 /**
  * 获取
  * @return msg
  */
 public String getMsg() {
  return msg;
 }

 /**
  * 设置
  * @param msg
  */
 public void setMsg(String msg) {
  this.msg = msg;
 }

 /**
  * 获取
  * @return data
  */
 public Object getData() {
  return data;
 }

 /**
  * 设置
  * @param data
  */
 public void setData(Object data) {
  this.data = data;
 }

 public String toString() {
  return "R{code = " + code + ", msg = " + msg + ", data = " + data + "}";
 }
}
